<html>

<!-- Mirrored from introcomputing.org/image-3-exercises.html by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 24 Jan 2019 10:56:44 GMT -->
<head>
<title>Image 3 Exercises</title>
<link rel=stylesheet href=style.css type="text/css">

</head>
<body>
<script type="text/javascript" src="cs101.js"></script>
<script type="text/javascript" src="cs101-table.js"></script>
<script type="text/javascript" src="cs101-simulation.js"></script>

<!-- njp
<div id=warning-output></div>
-->

<h1>Image 3 Exercises</h1>

<p>



<p>
1. Add code inside the loop to modify flowers.jpg like this: set each pixel to have red 255, green 0, blue 0.

<p style='max-width:1000'>
<table class=run>
<tr><td valign=top width=550> <!-- CODE -->
<textarea id="image3-ex1" rows=13 cols=70  class=tacode spellcheck=false
onKeyPress='return handleCR(this ,event)'>
image = new SimpleImage("flowers.jpg");

for (pixel: image) {
  // Your code here
  
}

print(image);</textarea>
<br><input type=button style='width:220;height:40;background-color:lightgray'
value="Run" onClick='evaluateClear("image3-ex1")'>
</td>
<td valign=top> <!-- OUTPUT -->
<div id='image3-ex1-output' style="font-family:courier;font-size:14;"></div>
</td></tr>
</table>


<p>
2. Add code inside the loop to modify flowers.jpg like this: set each pixel to have green of 0, leaving red and blue unchanged. The result should be that the flowers look red, since the yellow was made of red+green light.

<p style='max-width:1000'>
<table class=run>
<tr><td valign=top width=550> <!-- CODE -->
<textarea id="image3-ex2" rows=13 cols=70  class=tacode spellcheck=false
onKeyPress='return handleCR(this ,event)'>
image = new SimpleImage("flowers.jpg");

for (pixel: image) {
  // Your code here
  
}

print(image);</textarea>
<br><input type=button style='width:220;height:40;background-color:lightgray'
value="Run" onClick='evaluateClear("image3-ex2")'>
</td>
<td valign=top> <!-- OUTPUT -->
<div id='image3-ex2-output' style="font-family:courier;font-size:14;"></div>
</td></tr>
</table>


</body>

<!-- Mirrored from introcomputing.org/image-3-exercises.html by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 24 Jan 2019 10:56:44 GMT -->
</html>

